package main

import (
	"os"
	"log"
	"io"
	"net/http"
	"bytes"
	"fmt"
)

func main() {

	var b bytes.Buffer
	b.Write([]byte("Hello"))
	fmt.Fprintf(&b, "--world--%s", "lll")
	b.WriteTo(os.Stdout)

	dir, err := os.Getwd()
	if err != nil {
		log.Fatal(err)
	}
	log.Println(dir)

	//os.Create(dir + "/doc/os/os.txt")
	//file, _ := os.Create("os.txt")
	file, _ := os.OpenFile("logs/os.txt", os.O_CREATE|os.O_APPEND, 0666)
	defer file.Close()

	dest := io.MultiWriter(file, os.Stdout)
	resp, _ := http.Get("https://blog.csdn.net/qq_534019165/article/details/46619461")
	io.Copy(dest, resp.Body)

}
